﻿using System.Collections;
using Gp.Scripts.GUI;
using UnityEngine;

namespace Gp.Scripts.Core {
    public enum FxCode {
        /// <summary>
        /// 升级
        /// </summary>
        UpGrade,
        
        /// <summary>
        /// 加速
        /// </summary>
        Accelerate,
        
        
        /// <summary>
        /// 蓄力
        /// </summary>
        Accumulate,
        
        Invisible,
        
        DefenceUp,
        
        
        /// <summary>
        /// 恢复
        /// </summary>
        Recover,
        
        
        /// <summary>
        /// 修复
        /// </summary>
        Repair,
        
        
        /// <summary>
        /// 献祭
        /// </summary>
        Sacrifice,
        
        /// <summary>
        /// 释放压力
        /// </summary>
        ReleasePressure,
    }
    
    
    
    public static class FxCodeExtend {
        public static float Play(this FxCode code, BaseUnit unit) {
            return Global.Get<GridBattleGUISystem>().FeedBackPlayer.PlayFx(unit, code);
        }
        
        public static IEnumerator YieldPlay(this FxCode code, BaseUnit unit) {
            yield return new WaitForSeconds(Play(code, unit));
        }
    }
    
}